package com.lx.pc.service;

import java.io.Serializable;
import java.util.List;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import com.lx.pc.domain.entity.SuperBaseEntity;

/**
 * 抽象服务
 * 
 * @author houzhong
 *
 * @param <V>
 * @param <ID>
 */
public interface IService<V extends SuperBaseEntity, ID extends Serializable> {

	/**
	 * 保存
	 * 
	 */
	public void save(V v);

	/**
	 * 批量保存
	 * 
	 */
	public Long save(List<V> list);

	/**
	 * 更新
	 * 
	 * @return
	 */
	public Integer update(V condition, V update);

	/**
	 * 根据Id更新
	 * 
	 * @return
	 */
	public Integer update(ID id, Long version, V update);

	/**
	 * 根据id删除
	 * 
	 * @return
	 */
	public Integer delete(ID id, Long version, Boolean isLogicDelete);

	/**
	 * 根据id查找
	 * 
	 * @return
	 */
	public V find(ID id);

	/**
	 * 根据id查找和版本号
	 * 
	 * @return
	 */
	public V find(ID id, Long version);

	/**
	 * 查询总条数
	 * 
	 * @return
	 */
	public long count(V condition, boolean isEqCondition);

	/**
	 * 分页查询
	 * 
	 * @return
	 */
	public Page<V> find(V condition, boolean isEqCondition, Pageable pageable);

	/**
	 * 查找所有
	 * 
	 * @param condition
	 * @param isEqCondition
	 * @return
	 */
	public List<V> findAll(V condition, boolean isEqCondition);

}
